<template>
    <van-nav-bar title="分类" left-arrow @click-left="() => { $router.push('/') }" fixed />
    <div style="height: 45px;"></div>
    <van-row>
        <van-col span="6">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in categoriesApiData" :title="item.cat_name" />
            </van-sidebar>
        </van-col>
        <van-col span="18">
            <div v-for="item in categoriesApiData[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <van-grid :column-num="4">
                    <van-grid-item v-for="items in item.children" :icon="items.cat_icon" :text="items.cat_name" />
                </van-grid>
            </div>
        </van-col>
    </van-row>
</template>

<script setup>
import { ref } from "vue";
import { categoriesApi } from "@/api/api";
let categoriesApiData = ref([])
categoriesApi().then(res => {
    console.log('分类', res);
    categoriesApiData.value = res.data.message
})
let active =ref(1)
</script>

<style lang="scss" scoped></style>